package org.example.shujuleixing;

import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;

public class Test {


    public static void main(String[] args) throws MQClientException, InterruptedException {

        DefaultMQProducer producer = new DefaultMQProducer("producer_dw_test");
        producer.setNamesrvAddr("172.20.20.80:9876;172.20.20.81:9876");
        producer.start();
        for (int i = 600000; i < 600100; i++) {
            try {
                Message msg = new Message("topic_dw_test_by_order_02", null, "m" + i, ("Hello RocketMQ" + i).getBytes(RemotingHelper.DEFAULT_CHARSET));
                SendResult sendResult = producer.send(msg);
                System.out.printf("%s%n", sendResult);
            } catch (Exception e) {
                e.printStackTrace();
                Thread.sleep(1000);
            }
        }
        producer.shutdown();
        System.out.println("end");
//        System.out.println("进制位数：" + Integer.SIZE);
//        System.out.println("最小值：" + Integer.MIN_VALUE);
//        System.out.println("最大值：" + Integer.MAX_VALUE);
//        System.out.println("进制位数：" + Double.SIZE);
//        System.out.println("最小值：" + Double.MIN_VALUE);
//        System.out.println("最大值：" + Double.MAX_VALUE);

        // 自动转换
//        int i = 112 ;
//        long j = i ;
//        System.out.println(j);
//        // 强制转换
//        double d = 13.14 ;
//        int f = (int)d;
//        System.out.println(f);
//        // 类型提升
//        long r = i * j ;
//        System.out.println(r);

    }

}
